class Solution {
public:
    int minimumSum(int n, int k) {
        int m = min(k / 2, n);
        return (m + 1) * m / 2 + (2 * k + n - m - 1) * (n - m) / 2;
    }
};
